<script>
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { Toast } from 'vant';
export default {
    setup() {
        const checked = ref(false);
        const active = ref(false);
        const index = ref(false);

        let router = useRouter();

        //账号与安全
        let safe = () => {
            router.push("/safe")
        }
        //关于
        let Tomato = () => {
            router.push("/tomato")
        }

        //返回上一页
        let back = () => {
            router.back()
        }

        //退出登录
        let Tuichu = () => {
            window.localStorage.removeItem("shelf")
            window.localStorage.removeItem("coin")
            window.localStorage.removeItem("tickey")
            window.localStorage.removeItem("token")
            window.localStorage.removeItem("password")
            router.push("/center")
            Toast.success("退出成功")
            
        }

        return {
            checked,
            active,
            index,
            safe,
            back,
            Tomato,
            Tuichu
        };
    },
}
</script>

<template>
    <div class="setup_box">
        <div class="container">
            <div class="set_top">
                <span class="iconfont icon-arrow-left" @click="back"></span>
                <h3>设置</h3>
            </div>
            <div class="cache">
                <p>清除缓存</p>
                <span>0B</span>
            </div>
            <div class="manage">
                <ul>
                    <li @click="safe">
                        <p>账号与安全</p>
                        <span class="iconfont icon-xuanxiangqiayoujiantou"></span>
                    </li>
                    <li>
                        <p>支付管理</p>
                        <span class="iconfont icon-xuanxiangqiayoujiantou"></span>
                    </li>
                    <li>
                        <p>夜间模式跟随系统设置</p>
                        <van-switch v-model="checked" size="15px" active-color="#fe631b" inactive-color="#dcdee0" />
                    </li>
                    <li>
                        <p>WiFi较差时使用移动网络优化体验</p>
                        <van-switch v-model="active" size="15px" active-color="#fe631b" inactive-color="#dcdee0" />
                    </li>
                    <li>
                        <p>青少年模式</p>
                        <van-switch v-model="index" size="15px" active-color="#fe631b" inactive-color="#dcdee0" />
                    </li>
                    <li>
                        <p>客服</p>
                        <span class="iconfont icon-xuanxiangqiayoujiantou"></span>
                    </li>
                </ul>
            </div>
            <div class="manage">
                <ul>
                    <li @click="Tomato">
                        <p>关于番茄</p>
                        <span class="iconfont icon-xuanxiangqiayoujiantou"></span>
                    </li>
                    <li @click="Tuichu">
                        <p>退出登录</p>
                        <span class="iconfont icon-xuanxiangqiayoujiantou"></span>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</template>

<style lang="scss" scoped>
@import "../assets/font-two/iconfont.css";
.van-theme-dark body {
  color:#f5f5f5;
  background-color: black;
}
.setup_box {
    background-color: #f6f6f6;
    padding: 20px 16px 64px 16px;

    .set_top {
        display: flex;
        align-items: center;

        h3 {
            margin: 0 auto;
            font-weight: 600;
        }

        .icon-arrow-left {
            font-size: 17px;
        }
    }

    .cache {
        background-color: #fff;
        padding: 18px;
        display: flex;
        justify-content: space-between;
        border-radius: 10px;
        margin-top: 26px;

        p {
            font-size: 15px;
        }

        span {
            color: #cccccc;
        }
    }

    .manage {
        background-color: #fff;
        margin-top: 15px;
        border-radius: 10px;

        ul {
            li {
                display: flex;
                justify-content: space-between;
                padding: 18px;
                align-items: center;

                p {
                    font-size: 15px;
                }

                span {
                    color: #ccc;
                }
            }
        }
    }
}
</style>